
import TableData from "@/components/HntManage/el-tables"; //主页面列表
import formJs from "./regexDetail.js"; //新增弹框配置项
import {
    getWbsWorkSteps //详情
} from "@/api/request.js";
import { objectType,statusStep,WorkType } from "@/utils/config"; //配置项

export default {
    props: [
        "dialogVisible",
        "dialogTitle",
        "projectId",
        "status",
        "currentRow",

    ],
    data() {
        return {
            visible: "",
            title: "查看",
            btnStatus: [],
            dialogHeight: null,
            activeIndex: "1",
            formObj: formJs.formObj,
            table_config: formJs.dialog_config,
            tableData: [],
            currntData: null,
            dataInfo: null,
            loading: false,
            currentStatus: null,
        };
    },
    components: {
        TableData
        // commonPage
    },
    watch: {
        dialogVisible: {
            handler(newVal) {
                if (newVal) {
                    this.visible = newVal;
                }
            },
            immediate: true,
        },
        currentRow: {
            handler(newVal) {
                if (newVal) {
                    this.getDetail(newVal);
                }
            },
            immediate: true,
        },
    },
    created() {
        window.addEventListener("resize", this.getHeight);
        this.getHeight();
    }, //获取页面高度自适应：

    destroyed() {
        window.removeEventListener("resize", this.getHeight);
        this.getHeight();
    },
    mounted() {
        this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
        this.table_config.thead[0]["callback"] = function (rowData) {
            let data = objectType[rowData.FinishSign];
            if (data) {
              return data.label;
            }
          };
          this.table_config.thead[4]["callback"] = function (rowData) {
            let data = statusStep[rowData.StepState];
            if (data) {
              return data.label;
            }
          };
          this.table_config.thead[3]["callback"] = function (rowData) {
            let data = WorkType[rowData.WorkType];
            if (data) {
              return data.label;
            }
          };
       
        this.table_config.thead[5]["callback"] = function (rowData) {
            let data = objectType[rowData.iskey];
            if (data) {
              return data.label;
            }
          };
          this.table_config.thead[6]["callback"] = function (rowData) {
            let data = objectType[rowData.IsConcealed];
            if (data) {
              return data.label;
            }
          };
          this.table_config.thead[7]["callback"] = function (rowData) {
            let data = objectType[rowData.IsDisposable];
            if (data) {
              return data.label;
            }
          };
        //   
        this.getHeight();
    },
    methods: {
        getHeight() {
            var h = document.documentElement.clientHeight; //获取页面可见高度
            this.dialogHeight = h * 0.76 + "px";
        },
        closeDialog() {
            this.$emit("close");
        },
        rowChange(val) {
           return val;
        },
        // 详情
        getDetail(data1) {
            this.loading = true
            var data = {
                orgCode: this.projectId, //必传 传标段id(目前只有青银二广点击标段有数据)(1标:a1d978df-6665-4836-b892-5368af07dedd 2标:4ec357bf-6fbb-474d-9345-e57bad661ce7 3标:f8c992c1-a9e9-4d10-a784-4f3b9f0b588d)
                parentCode: data1.ParentCode, // 最下面一层的ParentCode 从工序页面点 必传
                orgType: data1.Code, //最下面一层的code 从工序页面点 必传
                stationType: "", //是否为隐蔽工序 传1查隐蔽 不查传0或不传
            }
            getWbsWorkSteps(data).then((res) => {
                this.loading = false;
                var data = res.data.data;
               
                this.tableData = data
            });
        },

    },
};